文档 / 子平台 API

用户与认证

认证平台(auth)

密码登录

POST /auth/v1/auth/token
{
  "grant_type": "password",
  "username": "user1",
  "password": "***"
}
→ { "access_token": "...", "token_type": "Bearer", "expires_in": 3600 }

刷新令牌

POST /auth/v1/auth/token
{ "grant_type": "refresh_token", "refresh_token": "..." }

OTP 验证码

POST /auth/v1/otp/send    { "channel": "email|sms", "target": "..." }
POST /auth/v1/otp/verify  { "target": "...", "code": "123456" }

用户平台(user)

# 当前用户
GET /user/v1/users/me                    # 需要 Bearer

# 用户资料
PATCH /user/v1/users/me   { "nickname": "新昵称", "avatar_url": "..." }

# 管理员查用户(应用内)
GET /user/v1/users?page=1&page_size=20

RBAC

平台支持角色与授权:应用可建角色,给用户分配角色,接口按 scope 鉴权。常用 scope:

scope含义
user:read读用户
user:write写用户
user:admin用户管理(角色/冻结)
auth:token签发令牌
points:read/write积分

会话与安全

  • 令牌过期可刷新;退出登录 POST /auth/v1/auth/logout
  • 异地登录/冻结等异常可在 auth 平台配置;
  • 密码复杂度强制(≥ 12 位复杂密码用于后台账号);
  • 所有令牌泄露场景:轮换 sk 或撤销用户令牌。